package com.eco.fanliapp.controller.app;


import com.eco.fanliapp.common.base.BaseController;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.entity.AppUser;
import com.eco.fanliapp.service.ISyUserSignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户签到
 * 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2020-03-26
 */
@RestController
@RequestMapping("/app/user")
public class SyUserSignController extends BaseController {
    @Autowired
    private ISyUserSignService syUserSignService;

    @Autowired
    private ISyUserSignService iSyUserSignService;

    /**
     * 日常任务7天签到(加金币)
     *
     * @return
     */
    @GetMapping("/sign/toSign")
    @ResponseBody
    public ServerResponse toSignTask() {
        AppUser u = getAppUser();
        if (null == u) {
            return ServerResponse.createByErrorCodeMessage(301, "Token不正确");
        }
        return iSyUserSignService.userToSign(u.getUserId());
    }
}
